Optimal. Leaf size=136 \[ -b^2 c x-\frac {1}{2} b^2 d x^2+\frac {a^2 (c+d x)^2}{2 d}+\frac {i a b (c+d x)^2}{d}-\frac {2 a b (c+d x) \log \left (1+e^{2 i (e+f x)}\right )}{f}+\frac {b^2 d \log (\cos (e+f x))}{f^2}+\frac {i a b d \text {PolyLog}\left (2,-e^{2 i (e+f x)}\right )}{f^2}+\frac {b^2 (c+d x) \tan (e+f x)}{f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.12, antiderivative size = 136, normalized size of antiderivative = 1.00, number of steps
used = 9, number of rules used = 7, integrand size = 18, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.389, Rules used = {3803, 3800,
2221, 2317, 2438, 3801, 3556} \begin {gather*} \frac {a^2 (c+d x)^2}{2 d}-\frac {2 a b (c+d x) \log \left (1+e^{2 i (e+f x)}\right )}{f}+\frac {i a b (c+d x)^2}{d}+\frac {i a b d \text {Li}_2\left (-e^{2 i (e+f x)}\right )}{f^2}+\frac {b^2 (c+d x) \tan (e+f x)}{f}-b^2 c x+\frac {b^2 d \log (\cos (e+f x))}{f^2}-\frac {1}{2} b^2 d x^2 \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2221
Rule 2317
Rule 2438
Rule 3556
Rule 3800
Rule 3801
Rule 3803
Rubi steps
\begin {align*} \int (c+d x) (a+b \tan (e+f x))^2 \, dx &=\int \left (a^2 (c+d x)+2 a b (c+d x) \tan (e+f x)+b^2 (c+d x) \tan ^2(e+f x)\right ) \, dx\\ &=\frac {a^2 (c+d x)^2}{2 d}+(2 a b) \int (c+d x) \tan (e+f x) \, dx+b^2 \int (c+d x) \tan ^2(e+f x) \, dx\\ &=\frac {a^2 (c+d x)^2}{2 d}+\frac {i a b (c+d x)^2}{d}+\frac {b^2 (c+d x) \tan (e+f x)}{f}-(4 i a b) \int \frac {e^{2 i (e+f x)} (c+d x)}{1+e^{2 i (e+f x)}} \, dx-b^2 \int (c+d x) \, dx-\frac {\left (b^2 d\right ) \int \tan (e+f x) \, dx}{f}\\ &=-b^2 c x-\frac {1}{2} b^2 d x^2+\frac {a^2 (c+d x)^2}{2 d}+\frac {i a b (c+d x)^2}{d}-\frac {2 a b (c+d x) \log \left (1+e^{2 i (e+f x)}\right )}{f}+\frac {b^2 d \log (\cos (e+f x))}{f^2}+\frac {b^2 (c+d x) \tan (e+f x)}{f}+\frac {(2 a b d) \int \log \left (1+e^{2 i (e+f x)}\right ) \, dx}{f}\\ &=-b^2 c x-\frac {1}{2} b^2 d x^2+\frac {a^2 (c+d x)^2}{2 d}+\frac {i a b (c+d x)^2}{d}-\frac {2 a b (c+d x) \log \left (1+e^{2 i (e+f x)}\right )}{f}+\frac {b^2 d \log (\cos (e+f x))}{f^2}+\frac {b^2 (c+d x) \tan (e+f x)}{f}-\frac {(i a b d) \text {Subst}\left (\int \frac {\log (1+x)}{x} \, dx,x,e^{2 i (e+f x)}\right )}{f^2}\\ &=-b^2 c x-\frac {1}{2} b^2 d x^2+\frac {a^2 (c+d x)^2}{2 d}+\frac {i a b (c+d x)^2}{d}-\frac {2 a b (c+d x) \log \left (1+e^{2 i (e+f x)}\right )}{f}+\frac {b^2 d \log (\cos (e+f x))}{f^2}+\frac {i a b d \text {Li}_2\left (-e^{2 i (e+f x)}\right )}{f^2}+\frac {b^2 (c+d x) \tan (e+f x)}{f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 2.21, size = 200, normalized size = 1.47 \begin {gather*} \frac {\cos (e+f x) \left (\cos (e+f x) \left (-\left ((e+f x) \left (-2 i a b d (e+f x)+a^2 (d e-2 c f-d f x)+b^2 (-d e+2 c f+d f x)\right )\right )-4 a b d (e+f x) \log \left (1+e^{2 i (e+f x)}\right )+2 b (b d+2 a d e-2 a c f) \log (\cos (e+f x))\right )+2 i a b d \cos (e+f x) \text {PolyLog}\left (2,-e^{2 i (e+f x)}\right )+2 b^2 f (c+d x) \sin (e+f x)\right ) (a+b \tan (e+f x))^2}{2 f^2 (a \cos (e+f x)+b \sin (e+f x))^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.23, size = 238, normalized size = 1.75
method | result | size |
risch | \(-\frac {b^{2} d \,x^{2}}{2}+\frac {2 i b^{2} \left (d x +c \right )}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}+\frac {a^{2} d \,x^{2}}{2}-b^{2} c x +i a b d \,x^{2}+a^{2} c x +\frac {4 i b a d e x}{f}+\frac {b^{2} d \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{f^{2}}-\frac {2 b^{2} d \ln \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f^{2}}-\frac {2 b a c \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{f}+\frac {4 b a c \ln \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f}-\frac {4 b a d e \ln \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f^{2}}-2 i a b c x +\frac {2 i b a d \,e^{2}}{f^{2}}+\frac {i a b d \polylog \left (2, -{\mathrm e}^{2 i \left (f x +e \right )}\right )}{f^{2}}-\frac {2 b \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a d x}{f}\) | \(238\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Both result and optimal contain complex but leaf count of result is larger than
twice the leaf count of optimal. 559 vs. \(2 (127) = 254\).
time = 0.58, size = 559, normalized size = 4.11 \begin {gather*} \frac {2 \, {\left (f x + e\right )} a^{2} c + \frac {{\left (f x + e\right )}^{2} a^{2} d}{f} - \frac {2 \, {\left (f x + e\right )} a^{2} d e}{f} + 4 \, a b c \log \left (\sec \left (f x + e\right )\right ) - \frac {4 \, a b d e \log \left (\sec \left (f x + e\right )\right )}{f} + \frac {2 \, {\left ({\left (2 \, a b + i \, b^{2}\right )} {\left (f x + e\right )}^{2} d + 4 \, b^{2} c f - 4 \, b^{2} d e + 2 \, {\left (i \, b^{2} c f - i \, b^{2} d e\right )} {\left (f x + e\right )} - 2 \, {\left (2 \, {\left (f x + e\right )} a b d - b^{2} d + {\left (2 \, {\left (f x + e\right )} a b d - b^{2} d\right )} \cos \left (2 \, f x + 2 \, e\right ) - {\left (-2 i \, {\left (f x + e\right )} a b d + i \, b^{2} d\right )} \sin \left (2 \, f x + 2 \, e\right )\right )} \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) + {\left ({\left (2 \, a b + i \, b^{2}\right )} {\left (f x + e\right )}^{2} d + 2 \, {\left (i \, b^{2} c f + b^{2} d {\left (-i \, e - 2\right )}\right )} {\left (f x + e\right )}\right )} \cos \left (2 \, f x + 2 \, e\right ) + 2 \, {\left (a b d \cos \left (2 \, f x + 2 \, e\right ) + i \, a b d \sin \left (2 \, f x + 2 \, e\right ) + a b d\right )} {\rm Li}_2\left (-e^{\left (2 i \, f x + 2 i \, e\right )}\right ) - {\left (-2 i \, {\left (f x + e\right )} a b d + i \, b^{2} d + {\left (-2 i \, {\left (f x + e\right )} a b d + i \, b^{2} d\right )} \cos \left (2 \, f x + 2 \, e\right ) + {\left (2 \, {\left (f x + e\right )} a b d - b^{2} d\right )} \sin \left (2 \, f x + 2 \, e\right )\right )} \log \left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - {\left ({\left (-2 i \, a b + b^{2}\right )} {\left (f x + e\right )}^{2} d + 2 \, {\left (b^{2} c f - b^{2} d {\left (e - 2 i\right )}\right )} {\left (f x + e\right )}\right )} \sin \left (2 \, f x + 2 \, e\right )\right )}}{-2 i \, f \cos \left (2 \, f x + 2 \, e\right ) + 2 \, f \sin \left (2 \, f x + 2 \, e\right ) - 2 i \, f}}{2 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.37, size = 228, normalized size = 1.68 \begin {gather*} \frac {{\left (a^{2} - b^{2}\right )} d f^{2} x^{2} + 2 \, {\left (a^{2} - b^{2}\right )} c f^{2} x - i \, a b d {\rm Li}_2\left (\frac {2 \, {\left (i \, \tan \left (f x + e\right ) - 1\right )}}{\tan \left (f x + e\right )^{2} + 1} + 1\right ) + i \, a b d {\rm Li}_2\left (\frac {2 \, {\left (-i \, \tan \left (f x + e\right ) - 1\right )}}{\tan \left (f x + e\right )^{2} + 1} + 1\right ) - {\left (2 \, a b d f x + 2 \, a b c f - b^{2} d\right )} \log \left (-\frac {2 \, {\left (i \, \tan \left (f x + e\right ) - 1\right )}}{\tan \left (f x + e\right )^{2} + 1}\right ) - {\left (2 \, a b d f x + 2 \, a b c f - b^{2} d\right )} \log \left (-\frac {2 \, {\left (-i \, \tan \left (f x + e\right ) - 1\right )}}{\tan \left (f x + e\right )^{2} + 1}\right ) + 2 \, {\left (b^{2} d f x + b^{2} c f\right )} \tan \left (f x + e\right )}{2 \, f^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \tan {\left (e + f x \right )}\right )^{2} \left (c + d x\right )\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int {\left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )}^2\,\left (c+d\,x\right ) \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________